home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 1035 / 1035.xpi / chrome / 1clickweather.jar / content / 1clickweather / js / config / configmanager.js < prev    next >
Text File  |  2008-10-05  |  1KB  |  62 lines

  1. // ⌐ 2005 The Weather Channel Interactive, Inc.  All Rights Reserved.
  2.  
  3. /*
  4.     ConfigManager - Manager object for
  5.     application configuration files
  6. */
  7. function ConfigManager() {
  8. }
  9.  
  10. // set prototype for ConfigManager
  11. ConfigManager.prototype = {
  12.  
  13.     // THIS METHOD RETURNS THE APP
  14.     // CONFIG OBJECT REPRESENTATION
  15.     getAppConfig: function() {
  16.         var appConfig = new AppConfig();
  17.         try {
  18.             appConfig.load();
  19.         } catch(e) {
  20.             alert("ConfigManager.getAppConfig(): " + e);
  21.         }
  22.         return appConfig;
  23.     },
  24.  
  25.     // THIS METHOD RETURNS THE USER
  26.     // CONFIG OBJECT REPRESENTATION
  27.     getUserConfig: function() {
  28.         var userConfig = new UserConfig();
  29.         try {
  30.             userConfig.load();
  31.         } catch(e) {
  32.             alert("ConfigManager.getUserConfig(): " + e);
  33.         }
  34.         return userConfig;
  35.     },
  36.  
  37.     // THIS METHOD SETS THE APP
  38.     // CONFIG OBJECT REPRESENTATION
  39.     setAppConfig: function(newAppConfig) {
  40.         try {
  41.             newAppConfig.save();
  42.             return 1;
  43.         } catch(e) {
  44.             alert("ConfigManager.setAppConfig(): " + e);
  45.             return 0;
  46.         }
  47.     },
  48.  
  49.     // THIS METHOD SETS THE USER
  50.     // CONFIG OBJECT REPRESENTATION
  51.     setUserConfig: function(newUserConfig) {
  52.         try {
  53.             newUserConfig.save();
  54.             return 1;
  55.         } catch(e) {
  56.             alert("ConfigManager.setUserConfig(): " + e);
  57.             return 0;
  58.         }
  59.     }    
  60. };
  61.  
  62.